#
# @lc app=leetcode.cn id=88 lang=python3
#
# [88] 合并两个有序数组
#

# @lc code=start
class Solution:
    def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:
        """
        Do not return anything, modify nums1 in-place instead.
        """
        i = 0
        j = 0
        while i < m and j < n:
            if nums2[j] <= nums1[i]:
                m += 1
                
                for k in range(m-1, i, -1):
                    nums1[k] = nums1[k-1]
                
                nums1[i] = nums2[j]
                j += 1
            i += 1
        
        if n == j:
            return
        else:
            for k in range(j,n):
                nums1[i] = nums2[k]
                i += 1
            return               
# @lc code=end

